function R = klinkage(datasetLabel,Kfile,Lfile,Tfile)
%
% load kernel matrix K from space delimited file Kfile
% calculate distance matrix (as U-vector. U as in LU factorisation)
% cluster data into C and return structure
%
% R.Kernel	kernel matrix
% R.Distance	distance matrix
% R.Labels	instance truth labels vector (strings)
% R.Truth	instance truth class id vector (ints 1..|#classes|)
% R.Clusters	linkage (cluster) matrix
%

%path = 'C:\sites\price\phd\mypapers\ijcai05\kernels\';
path = 'Z:\simonp\Documents\svn_kernels';

R.label  = datasetLabel;
R.Kernel = csvread([path,Kfile]);
R.Labels = importdata([path,Lfile]);
R.Truth  = importdata([path,Tfile]);

Du = pdist(R.Kernel);
R.Clusters = linkage(Du);

R.Distance = squareform(Du);
